package com.threadExample;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;

/**
 * Created by yijy on 2017/12/15.
 */
public class TimeLineLog implements Runnable{
    private static String IMELINE_LOG = "d://11.txt";
    static boolean keep = false;

    @Override
    public void run() {
        File file = new File(IMELINE_LOG);
        try {
            BufferedWriter bw=null;
            while(!keep){
                String timeLine= null;
                for(int i=0;i<1000;i++){
                    timeLine= "你好！"+i;
                    System.out.println(timeLine);
                }
                bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file.getPath())));
                bw.write(timeLine);
                bw.flush();
                bw.close();
            }


        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}